<?php
class EmpRegister extends MySQLCN {

    function Add() {
        $qry = "INSERT INTO `users` 
            ( `Email`, `Name`, `Login`,`department`, `reporting_mgr`, `dt_ofjoin`, `dt_ofleave`, `tenure`, `billing_status`,`emp_status`,`cab_status`,`address`,`shift_in`) 
            VALUES 
            ( '{$_POST['Email']}', '{$_POST['name']}', '{$_POST['Login']}', 
              '{$_POST['dept']}', '{$_POST['reportmgr']}', '{$_POST['from']}', '{$_POST['to']}', '{$_POST['tenure']}','{$_POST['billsts']}', '{$_POST['empsts']}', '{$_POST['cab']}', '{$_POST['address']}', '{$_POST['sitm']}')";
        return $this->insert($qry);
		
		
    }

    function Update($EmpID) {
        $check = $this->get($EmpID);
        if ($check == NULL) {
            return false;
        }
        $qry = "UPDATE `users` SET
              `Email` = '{$_POST['Email']}', 
              `Name` = '{$_POST['name']}', 
              `Login` = '{$_POST['Login']}', 
              `department` = '{$_POST['dept']}',
              `reporting_mgr` = '{$_POST['reportmgr']}', 
              `dt_ofjoin` = '{$_POST['from']}', 
              `dt_ofleave` = '{$_POST['to']}', 
              `tenure` = '{$_POST['tenure']}',
              `billing_status` = '{$_POST['billsts']}',
              `emp_status` = '{$_POST['empsts']}',
			  `cab_status` = '{$_POST['cab']}',
			  `address` = '{$_POST['address']}',
			  `shift_in` = '{$_POST['sitm']}'
               WHERE id = '{$EmpID}'";
        return $this->insert($qry);
    }

    function Delete($EmpID) {
        $qry = "DELETE FROM `users` WHERE id = '{$EmpID}'";
        return $this->insert($qry);
    }

    function get() {
        $qry = "SELECT * FROM `users` where id>1;";
        return $this->select($qry);
    }
    function get1($EmpID) {
        $qry = "SELECT * FROM `users` WHERE id = '{$EmpID}'";
        return $this->select($qry);
    }
   
    function AllList() {
        $qry = "SELECT * FROM users";
        return $this->select($qry);
    }
	
	function AllListUsr() {
        $qry = "SELECT Login,Name FROM users WHERE id > 1";
        return $this->select($qry);
    }
	
	function getReportMgr($EmpID) 
	{
        $qry = "SELECT Name 
                FROM `users` WHERE id = '{$EmpID}'";
        return $this->select($qry);
    }
    
}

?>